package main.od;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class LongestShorWood {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] inputStrArr = scanner.nextLine().split(" ");
        int add = Integer.parseInt(inputStrArr[1]);
        List<Integer> woodList = Arrays.stream(scanner.nextLine().split(" ")).map(Integer::parseInt).collect(Collectors.toList());
        int max = 0;
        Collections.sort(woodList);
        for (int i = 0;i < add;i++){
            woodList.set(0,woodList.get(0) + 1);
            Collections.sort(woodList);
            max = Math.max(max,woodList.get(0));
        }
        System.out.println("the max length of the shortest wood is " + max);
    }
}
